
import org.kwis.msp.lcdui.*;

public class GameMember {

    private Image[] image;
    private int x;
    private int y;
    private int height;
    private int width;
    private int index;
    private int color;

//------------  GameMember 생성자  ------------------
    public GameMember(int x, int y, Image[] image) 
    {
        this.image = image;
        index = 0;
		this.x=x;
		this.y=y;
        this.width = image[0].getWidth();
        this.height = image[0].getHeight();
	 }//GameMember

//----------- paint() -------------

	public void paint(Graphics g) {
    
        if (image == null) 
        {
            g.setColor(color);
            g.fillRect(x, y, width, height);
        } 
        else 
        {
            g.drawImage(image[index],x,y,Graphics.TOP|Graphics.HCENTER);
        }
    }//paint()

//3Step에서 추가 (시작)

//-------------imageToggler() --------

	public void imageToggler() 
    {
		switch(index)
		{
			case 0 : index =1; break ; 
			case 1 : index=0; break ; 
		}        
    }//imageToggler()



	public int getX() {return x;}

	public void setX(int x) {this.x = x;}

	public int getY(){return y;}

	public void setY(int y) {this.y= y;}

	public void move(int x, int y) {setX(x); setY(y);}

	public int getWidth() {return width; }
    
    public int getHeight() {return height;}

//3Step에서 추가 (끝)

} //GameMember
